package hlhj.fhp.checkpoint.presenter

import android.content.Context
import com.example.mymvp.mvp.BasePresenter
import hlhj.fhp.checkpoint.iview.AddCarView
import hlhj.fhp.checkpoint.javaBean.LimitBean
import hlhj.fhp.checkpoint.javaBean.LocationBean
import hlhj.fhp.checkpoint.javaBean.MyBaseBean
import hlhj.fhp.checkpoint.javaBean.PlateBean
import hlhj.fhp.checkpoint.module.AddCarModule

/**
 * Created by Never Fear   on 2018\11\8 0008.
Never More....
 */
class AddCarPresenter :BasePresenter<AddCarModule,AddCarView>(), AddCarModule.AddCarResp {
    override fun setLimit(limitBean: LimitBean) {
        view?.setLimit(limitBean)
    }
    fun getLimit(city_prefix:String,plate_prefix:String,c:Context){
        module?.getLimit(city_prefix, plate_prefix, c)

    }

    override fun cityResp(locationBean: LocationBean) {
        view?.setCitys(locationBean)
    }

    override fun allPlateResp(plateBean: PlateBean) {
        view?.setAllPlate(plateBean)
    }

    override fun addResult(myBaseBean: MyBaseBean) {
        view?.setAddResult(myBaseBean)
    }

    override fun createModule() {
        module=AddCarModule()
        module.listener=this
    }

    fun getAllPlate(c:Context){
        module?.getAllPlate(c)
    }

    fun getCity(c:Context){
        module?.getCity(c)
    }
    fun addCar(id:Int,plate_number:String,vin:String,engine_number:String,car_type:String,car_owner:String,owner_phone:String,plate_type:String,city:String,c:Context,registno:String,city_id:String){
        module?.addCar(id,plate_number, vin, engine_number, car_type, car_owner, owner_phone, plate_type,city, c,registno,city_id)
    }
}